#include"Task.hpp"
#include"Log.hpp"
#include<stdlib.h>
#include"threadpool.hpp"


int main()
{
    srand((unsigned int)time(nullptr));
    const string operators = "+/*/%";
    threadpool<Task>* tp=new threadpool<Task>();
    tp->start();

    // 派发任务的线程
    while(true)
    {
        int one = rand()%50;
        int two = rand()%10;
        char oper = operators[rand()%operators.size()];
        Log() << "主线程派发计算任务: " << one << oper << two << "=?" << "\n";
        Task t(one, two, oper);
        tp->push(t);
        sleep(1);
    }
    return 0;
}